'''
Created on May 13, 2011

@author: Armon
'''
import FeatureSuggestions
import Suggestion
import string

class AvgSentencesPerParagraph():
    '''
    classdocs
    '''

    def __init__(self, featureHandler, feature, noOfSentencesPerParagraph):
        
        self.featureSuggestions = []
        self.noOfSentencesPerParagraph = float(noOfSentencesPerParagraph)
        self.noOfSentencesPerParagraph = round(self.noOfSentencesPerParagraph)
        
        '''Following the English language standards, on average, each paragraph should be
        about 5 sentences per paragraph. So if the user writes less, suggest more sentences to their paragraphs'''
        if self.noOfSentencesPerParagraph < 5:
            self.stringSuggestion = "Add more sentences to each paragraph"
            
        else:
            self.stringSuggestion = "Reduce the number of sentences to each paragraph"
        
        '''For each section in all the document sections:
                Get the last sentence for each paragraph and highlight. Suggest to add/remove sentences per paragraph'''
        for section in range(len(featureHandler.documentSections)):
            documentSentences = featureHandler.documentSections[section].getSentences()
         
            lastSectionSentence = documentSentences[len(documentSentences) - 1]
            
            sentence = lastSectionSentence.text
            
            featureSuggestion = FeatureSuggestions.FeatureSuggestions(feature)
            self.avgSentencesPerParagraph = Suggestion.Suggestion('Paragraph change', featureHandler.document, "".join(sentence), self.stringSuggestion, '#FF8040')
            featureSuggestion.addSuggestions(self.avgSentencesPerParagraph)
            self.featureSuggestions.append(featureSuggestion)
            

    def getFeatureSuggestions(self):
        return self.featureSuggestions  